<?php
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'autoload.php';

use payClass\Datebase;
use payClass\QRcode;
use payClass\pay\Config;

/**
 * 扫码支付
 */
class Scan
{
	public static function scanDo()
	{
		$db     = new Datebase();

		$config = new Config();

		$param = $db->param();

		// 订单号
		$param['orderNumber'] = 'C' . time() . 'U' . $param['uid'];

		$param['paytype'] = Config::$folder.'-'.Config::$merchant;
		// 数据检测
		$verifyRes = $db->verifyScan($param);

		if ($verifyRes != 'Y') $db->ajaxReturn($verifyRes);
		switch ($param['price']) {
			case 3000:
				$payurl = 'https://www.payumoney.com/paybypayumoney/#/9926D9A7BA34A347E0B2267C7FFD1D80';
			break;
			case 6000:
				$payurl = 'https://www.payumoney.com/paybypayumoney/#/2934CBB4CC157DB2C285EC4AA0A46BCB';
			break;
			case 10000:
				$payurl = 'https://www.payumoney.com/paybypayumoney/#/97C6E754A7BAE875C7BF0121712735D8';
			break;
			case 30000:
				$payurl = 'https://www.payumoney.com/paybypayumoney/#/1F237D7FC79FCE3BBF7B84F5DE642E12';
			break;

		}

		//$db->ajaxReturn($resArray['payUrl']);
		header("Location:".$payurl);
	}
}

Scan::scanDo();
